﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.Communications.Core
{
    /// <summary>
    /// Geenric Communication bag...
    /// </summary>
    public class CommunicationBag
    {
        /// <summary>
        /// Gets or sets the creation date.
        /// </summary>
        /// <value>
        /// The message body.
        /// </value>
        public DateTime CreationDate { get; set; }
        /// <summary>
        /// Gets or sets the body.
        /// </summary>
        /// <value>
        /// The body.
        /// </value>
        public String Body { get; set; }
        /// <summary>
        /// Gets or sets the severity.
        /// </summary>
        /// <value>
        /// The severity.
        /// </value>
        public MessageSeverity Severity { get; set; }
        /// <summary>
        /// Gets or sets the type of the communication.
        /// </summary>
        /// <value>
        /// The type of the communication (it is considered the subject in the case of email sending)
        /// </value>
        public string Type { get; set; }
        /// <summary>
        /// Gets or sets the type of the communication.
        /// </summary>
        /// <value>
        /// The type of the communication.
        /// </value>
        public CommunicationMedia CommunicationType { get; set; }

        public CommunicationBag()
        {

        }

        /// <summary>
        /// To the message converter...
        /// </summary>
        /// <returns></returns>
        public Message ToMessage()
        {
            Message retValue = new Message();

            retValue.Id = Guid.NewGuid();
            retValue.IsReaded = false;
            retValue.MessageBody = Body;
            retValue.MessageDate = DateTime.Now;
            retValue.Severity = Severity;
            retValue.MessageType = Type;

            return retValue;
        }
    }
}
